<extend name="Base:main" />
<block name="content">
    <div class="tpl-content-wrapper">
            <div class="tpl-content-page-title">
                本地账户充值
            </div>
            <ol class="am-breadcrumb">
                <li><a href="#" class="am-icon-home">首页</a></li>
                <li><a href="#">账户管理</a></li>
                <li class="am-active">账户充值</li>
            </ol>
            <div class="tpl-portlet-components">
                <div class="portlet-title">
                      <div class="caption font-green bold">
                        <span class="am-icon-code"></span>充值
                    </div>
                </div>
                <div class="tpl-block ">

                    <div class="am-g tpl-amazeui-form">


                        <div class="am-u-sm-12 am-u-md-9">
                             <form class="am-form am-form-horizontal">
                     
							<style>
								.pay_class_type,.pay_class_type dl{ width:100%; }
								.pay_class_type dl dd{ width:120px; height:40px; border:1px solid #ccc; float:left; text-align:center; line-height:40px; font-size:14px; margin-right:10px;}
								.pay_class_type dl dd.active{ background:#0e90d2; border:1px solid #0e90d2; color:#fff; }
							</style>
							 <div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">支付方式</label>
									<div class="am-u-sm-9 float_left">
										<div class="pay_class_type">
											<dl style="margin:0px;">
												<notempty name="alipay_id">
												<dd data-payid="{$alipay_id}">支付宝</dd>
												</notempty>
												<notempty name="weixin_id">
												<dd data-payid="{$weixin_id}">微信</dd>
												</notempty>
											</dl>
										</div>
									</div>
							</div>
							<div class="am-form-group">
									<label for="user-email" class="am-u-sm-3 am-form-label">充值金额</label>
									<div class="am-u-sm-4 float_left">
									<input type="text" onblur="var re = /^[0-9]+(\.[0-9]{1,2})?$/; if( !re.test(this.value) ) this.value = 1; " id="money" value="1" placeholder="充值金额">
									</div>
							</div>
							<div class="am-form-group">
								<div class="am-u-sm-9 am-u-sm-push-3">
									<button type="button" id="ok_submit_pay" title="确认支付" class="am-btn am-btn-primary">确认支付</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
        </div>
		<script>
			$('.pay_class_type dl dd').click(function(){
				$('.pay_class_type dd.active').removeClass('active');
				$(this).addClass('active');
			});
			$('#ok_submit_pay').click(function(){
				if( $('.pay_class_type dl dd.active').length != 1 ) {
					error('请选择支付方式');
					return false;
				}
				var pay_id = $('.pay_class_type dl dd.active').attr('data-payid');
				if( pay_id == '' ) {
					error('请选择支付方式');
					return false;
				}
				zeroModal.confirm({
					content: '支付成功了吗？',
					buttons: [
						{ className: 'zeromodal-btn zeromodal-btn-primary', name: '支付成功', fn:function(opt){ location.reload() }},
						{ className: 'zeromodal-btn zeromodal-btn-default', name: '失败了', fn:function(opt){  }}
					]
				});

				window.open(getUrl('Pay/pay',{'pay_id':pay_id,'type':'recharge','id':1,'price':$('#money').val()}));
			});
		</script>
</block>